<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>sn配置管理</title>
	<meta name="decorator" content="default"/>
	<%@include file="/WEB-INF/views/include/dialog.jsp" %>
	<script type="text/javascript">
		$(document).ready(function() {
			$("#btnImport").click(function(){
				$.jBox($("#importBox").html(), {title:"导入数据", buttons:{"关闭":true}, 
					bottomText:"导入文件不能超过5M，仅允许导入“xls”或“xlsx”格式文件！"});
			});
		});
		function page(n,s){
			$("#pageNo").val(n);
			$("#pageSize").val(s);
			$("#searchForm").attr("action","${ctx}/jiujiudevice/jiuSn/");;
			$("#searchForm").submit();
        	return false;
        }
		
	</script>
</head>
<body>
	<div id="importBox" class="hide">
		<form id="importForm" action="${ctx}/jiujiudevice/jiuSn/import" method="post" enctype="multipart/form-data"
			style="padding-left:20px;text-align:center;"><br/>
			<input id="uploadFile" name="file" type="file" style="width:330px"/><br/><br/>　　
			<input id="btnImportSubmit" class="btn btn-primary" type="submit" value="   导    入   "/>
			<a href="${ctx}/jiujiudevice/jiuSn/import/template">下载模板</a>
		</form>
	</div>
	<ul class="nav nav-tabs">
		<li class="active"><a href="${ctx}/jiujiudevice/jiuSn/">sn配置列表</a></li>
		<shiro:hasPermission name="jiujiudevice:jiuSn:edit"><li><a href="${ctx}/jiujiudevice/jiuSn/form">sn配置添加</a></li></shiro:hasPermission>
	</ul>
	<form:form id="searchForm" modelAttribute="jiuSn" action="${ctx}/jiujiudevice/jiuSn/" method="post" class="breadcrumb form-search">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
		<label>SN:</label><form:input path="sn" htmlEscape="false" maxlength="50" class="input-medium" id="sn"/>
		&nbsp;<input id="btnSubmit" class="btn btn-primary" type="button" value="查询"/>
	&nbsp;<input id="btnImport" class="btn btn-danger" type="button" value="导入"/>
	&nbsp;<input id="btnExport" class="btn" style="background:blue;color:white;" type="button" value="导出"/>
	&nbsp;<input class="btn btn-success" type="button" onclick="download()" value="下载二维码"/>
	&nbsp;<input class="btn btn-warning" type="button" onclick="downAll()" value="批量下载二维码"/>
	</form:form>
	<tags:message content="${message}"/>
	<table id="contentTable" class="table table-striped table-bordered ">
		<thead><tr>
		<th>SN</th>
		<th>创建时间</th>
		<shiro:hasPermission name="jiujiudevice:jiuSn:edit"><th>操作</th></shiro:hasPermission></tr></thead>
		<tbody>
		<c:forEach items="${page.list}" var="jiuSn">
			<tr>
				<td><a href="${ctx}/jiujiudevice/jiuSn/form?id=${jiuSn.id}">${jiuSn.sn}</a></td>
				<td><fmt:formatDate value="${jiuSn.createTime }" type="both"/></td>
				<shiro:hasPermission name="jiujiudevice:jiuSn:edit"><td>
    				<a class="btn btn-success" href="${ctx}/jiujiudevice/jiuSn/form?id=${jiuSn.id}">修改</a>
					<a class="btn btn-danger" href="${ctx}/jiujiudevice/jiuSn/delete?id=${jiuSn.id}" onclick="return confirmx('确认要删除该sn配置吗？', this.href)">删除</a>
				</td></shiro:hasPermission>
			</tr>
		</c:forEach>
		</tbody>
	</table>
	<div class="pagination">${page}</div>
	<script type="text/javascript">
		$("#btnExport").click(function(){
			top.$.jBox.confirm("确认要导出数据吗？","系统提示",function(v,h,f){
				if(v=="ok"){
					$("#searchForm").attr("action","${ctx}/jiujiudevice/jiuSn/export");
					$("#searchForm").submit();
				}
			},{buttonsFocus:1});
			top.$('.jbox-body .jbox-icon').css('top','55px');
		});
		$("#btnSubmit").click(function(){
			$("#searchForm").attr("action","${ctx}/jiujiudevice/jiuSn/");;
			$("#searchForm").submit();
		});
		function download(){
			var sn = $("#sn").val();
			if(sn != null && sn != ""){
				location.href = "${ctx}/jiujiudevice/jiuSn/download?sn="+sn+"&m="+Math.random();
			}else{
				top.$.jBox.alert("请输入sn！");
			}
		}
		function downAll(){
				location.href = "${ctx}/jiujiudevice/jiuSn/downAll?m="+Math.random();
		}
	</script>
</body>
</html>
